let input = "Title\n\tSubtitle1\n\tSubtitle2\n\t\taaaa"
let str = 'aaaa'

function howDeep (input, str) {
  let deep = 1
  console.log(input.indexOf('\n'))
  let p = input.indexOf('\n')
  console.log(input.slice(p))
  if (p > -1) {
    let newInput = input.slice(p)
  }
}

console.log(howDeep(input, str))